import React from "react";
import { createBrowserRouter, Navigate } from "react-router-dom";
import Layout from "../layout/index";
import HomeIndex from "../pages/home/index";

const routerConfig = [
    {
        path: "/",
        element: <Navigate to="home-index" />,
    },
    {
        path: "/",
        id: "root",
        errorElement: <div>something error</div>,
        element: <Layout />,
        children: [
            {
                path: "/home-index",
                element: <HomeIndex />,
            },
            {
                path: "/home-test",
                element: <div>home test</div>,
            },
            {
                path: "/table-index",
                element: <div>table index</div>,
            },
            {
                path: "/table-test",
                element: <div>table test</div>,
            }
        ]
    },
    {
        path: "/login",
        element: <div>登录页面</div>,
    },
    {
        path: "*",
        element: <div>Page not found</div>,
    },
]

export const routes = createBrowserRouter(routerConfig);
